<style>
  view {
    text-align: center;
  }
  button {
    width: 300rpx;
  }
  text {
    display: block;
  }
</style>

<template>
  <view>
    <text class="lix-test--warning">获取到的iP地址为: {{ ip }}</text>
    <button @tap="onPress">网络请求示例</button>
    <Emit v-on:btntap="btntap"/>
  </view>
</template>

<script>
import { GET_IP_ADDRESS } from '../store/mutation-types';
import { mapGetters, mapActions } from 'vuex';
import Emit from '@/components/emit';
export default {
  created() {
    console.log('Hello world');
  },
  components: {
    Emit: Emit
  },
  computed: {
    ...mapGetters('fetch', {
      ip: 'ip'
    })
  },
  methods: {
    ...mapActions('fetch', {
      'onPress': GET_IP_ADDRESS
    }),
    btntap() {
      console.log('btntap');
    }
  }
};
</script>

<style lang="scss">
  @import "../theme-chalk/example.scss";
</style>


